
#include "SMSEngine.h"


class MChargeObserver
{
public:
	virtual void IsCharged(TBool aCharged, TInt aSum, TInt aCurrentNum) = 0;
};

class CETCharge : public CBase, public MSmsEngineObserver
{
public:
	IMPORT_C CETCharge();
	IMPORT_C ~CETCharge();
	IMPORT_C void SetObserver(MChargeObserver* aObserver);
	void CreateSmsEngine();


protected: // from MSmsEngineObserver
	virtual void CreatedMtmClientL();
	virtual void SendingMessage();
	virtual void MessageSent();
	virtual void MessageReceived(const TDesC& addr, const TDesC& msg);
	virtual void SmsEngineInitialized();
	virtual void SmsEngineError(TInt aErrorCode);
	virtual void MessageDeleted(); //if automatic deletion is on

public:
	void DeleteBuf();
	IMPORT_C TBool Charge(const TDesC& aDesc);
	
	
private:
	MChargeObserver*	iObserver;
	CSmsEngine*			iSmsEngine;
	

	HBufC*				iXmlBuf;
	HBufC*				iPhoneNum;
	HBufC*				iPhoneCon;
	HBufC*				iPhoneTimes;
	
	TInt				iMessageSums;
	TInt				iMessageNum;

	TBool				iCreatedMtmClient;
	TBool				iSucessed;
	
};